'use client';

import { IConfigSection } from '@/interfaces';

export default function QueryConfigSection({
  details,
}: {
  details: IConfigSection;
}) {
  return (
    <div className="row">
      <div className="col">
        <div className="card">
          <div className="card-header bg-transparent text-muted">
            <i className="bi bi-info-square me-2"></i>
            版块配置
          </div>
          <div className="card-body">
            <div className="table-responsive">
              <table className="table table-hover align-middle table-striped">
                <thead>
                  <tr className="text-nowrap">
                    <th scope="col" className="fw-normal">
                      ID
                    </th>
                    <th scope="col" className="fw-normal">
                      section
                    </th>
                  </tr>
                </thead>
                <tbody>
                  {Object.keys(details)
                    .filter((item) => !['id'].includes(item))
                    .map((item) => {
                      return (
                        <tr key={item} className="text-nowrap">
                          <td>
                            {item === 'enableCreateNotice' && '启用创建通知'}

                            {item === 'enableUpdateNotice' && '启用更新通知'}

                            {item === 'enableUpdateStateNotice' &&
                              '启用更新状态通知'}
                          </td>
                          <td>
                            {item === 'enableCreateNotice' &&
                              details[item] + ''}

                            {item === 'enableUpdateNotice' &&
                              details[item] + ''}

                            {item === 'enableUpdateStateNotice' &&
                              details[item] + ''}
                          </td>
                        </tr>
                      );
                    })}
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  );
}
